home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / wics.zip / DIAL.CPP < prev    next >
C/C++ Source or Header  |  1993-03-03  |  2KB  |  81 lines

  1. //==============================================================================================
  2. //
  3. //    Windows Interface Construction Set
  4. //    Version 1.00
  5. //
  6. //    DIAL.CPP - Dial (Volume Control) Class Source File
  7. //    Copyright ⌐ 1993 by Microdyne Development Technologies.
  8. //    All rights reserved.
  9. //==============================================================================================
  10.  
  11. #include <dial.h>
  12.  
  13. TDial::TDial(PTWindowsObject AParent, int AnId, int X, int Y, PTModule AModule)
  14.      : TScrollBar (AParent, AnId, X, Y, 57, 57, FALSE, AModule)
  15. {
  16. }
  17.  
  18. TDial::TDial(PTWindowsObject AParent, int ResourceId, PTModule AModule)
  19.      : TScrollBar (AParent, ResourceId, AModule)
  20. {
  21. }
  22.  
  23. void TDial::GetRange(Rint LoVal, Rint HiVal)
  24. {
  25.     GetDialRange(HWindow, &LoVal, &HiVal);
  26. }
  27.  
  28. int TDial::GetPosition()
  29. {
  30.     return GetDialPos(HWindow);
  31. }
  32.  
  33. void TDial::SetRange(int LoVal, int HiVal, BOOL fRedraw)
  34. {
  35.     SetDialRange (HWindow, LoVal, HiVal, fRedraw);
  36. }
  37.  
  38. void TDial::SetPosition(int ThumbPos)
  39. {
  40.     int LoVal , HiVal;
  41.  
  42.     GetRange(LoVal, HiVal);
  43.  
  44.     if ( ThumbPos > HiVal )
  45.         ThumbPos = HiVal;
  46.     else
  47.         if ( ThumbPos < LoVal )
  48.             ThumbPos = LoVal;
  49.  
  50.     if ( ThumbPos != GetPosition() )
  51.         SetDialPos(HWindow, ThumbPos, TRUE);
  52. }
  53.  
  54. /* Reads an instance of TDial from the passed ipstream. */
  55.  
  56. void *TDial::read(ipstream& is)
  57. {
  58.     TWindow::read(is);
  59.  
  60.     is >> LineMagnitude
  61.        >> PageMagnitude;
  62.  
  63.     return this;
  64. }
  65.  
  66. /* Writes the TScrollBar to the passed opstream. */
  67. void TDial::write(opstream& os)
  68. {
  69.     TWindow::write(os);
  70.  
  71.     os << LineMagnitude
  72.        << PageMagnitude;
  73. }
  74.  
  75. TStreamable *TDial::build()
  76. {
  77.     return new TDial(streamableInit);
  78. }
  79.  
  80. TStreamableClass RegDial("TDial", TDial::build, __DELTA(TDial));
  81.